﻿<Controls:MetroWindow
    x:Class="ChoBulkFileProcessor.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
    Title="Bulk File Processing Manager - Cinchoo Inc."
    Height="584"
    Width="798"
    MinHeight="505"
    MinWidth="700"
    AllowDrop="True"
    Drop="Window_Drop"
    Closed="Window_Closed"
    x:Name="MyWindow"
    xmlns:local="clr-namespace:ChoBulkFileProcessor"
    BorderBrush="{DynamicResource AccentColorBrush}"
    BorderThickness="1"
    TitleCaps="False"
    ResizeMode="CanResizeWithGrip"
    Loaded="MyWindow_Loaded" Icon="Icons/App.ico" Closing="Window_Closing" ContentRendered="MyWindow_ContentRendered">
    <Window.Resources>
        <ContextMenu x:Key="TextBoxContextMenu" Background="White">
            <MenuItem Command="ApplicationCommands.Copy">
                <MenuItem.Icon>
                    <Image Source="Resources/Copy.png" />
                </MenuItem.Icon>
            </MenuItem>
            <MenuItem Command="ApplicationCommands.Cut" >
                <MenuItem.Icon>
                    <Image Source="Resources/Cut.png" />
                </MenuItem.Icon>
            </MenuItem>
            <MenuItem Command="ApplicationCommands.Paste" >
                <MenuItem.Icon>
                    <Image Source="Resources/Paste.png" />
                </MenuItem.Icon>
            </MenuItem>
        </ContextMenu>
        <Style TargetType="{x:Type TextBox}">
            <Setter Property="ContextMenu" Value="{StaticResource TextBoxContextMenu}" />
        </Style>
        <!--<Style TargetType="Button">
            <Style.Resources>
                <Style TargetType="Image">
                    <Style.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" Value="0.5" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </Style.Resources>
        </Style>-->
        <!--<Style x:Key="itemContainerStyle">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=Description}" Value="Foo">
                    <Setter Property="ToolBar.OverflowMode" Value="Never"></Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style TargetType="ToolBar">
            <Setter Property="ItemContainerStyle" Value="{StaticResource itemContainerStyle}"></Setter>
        </Style>-->
        <Style x:Key="WaterMarkTextBoxStyle" BasedOn="{StaticResource {x:Type TextBox}}" TargetType="{x:Type TextBox}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TextBox}">
                        <Grid>
                            <Border x:Name="Bd" SnapsToDevicePixels="True" 
          Background="{TemplateBinding Background}" 
          BorderBrush="{TemplateBinding BorderBrush}"
          BorderThickness="{TemplateBinding BorderThickness}" >
                                <Grid>
                                    <ScrollViewer x:Name="PART_ContentHost"
                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                                    <TextBlock x:Name="textBlock"
                               Opacity="0.5"
                               Text="{TemplateBinding Tag}"
                               Padding="2,0,0,0"
                               TextWrapping="Wrap"
                               Visibility="Hidden" />
                                </Grid>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="Text"
                                       Value="" />
                                </MultiTrigger.Conditions>
                                <Setter Property="Visibility"
                                TargetName="textBlock"
                                Value="Visible" />
                            </MultiTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style
            TargetType="TextBlock"
            x:Key="StatusBarTextBlock">
            <Setter
                Property="TextWrapping"
                Value="NoWrap" />
            <Setter
                Property="TextTrimming"
                Value="CharacterEllipsis" />
            <Setter
                Property="Padding"
                Value="2,0" />
        </Style>
        <local:BoolInverterConverter x:Key="BoolInverterConverter1"/>
        <local:BoolInverterConverter x:Key="BoolInverterConverter2"/>
    </Window.Resources>
    <Grid Margin="0,0,0,-1">
        <Grid.RowDefinitions>
            <RowDefinition Height="30"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="25"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition MinWidth="400" />
            <ColumnDefinition Width="153" MinWidth="153" MaxWidth="350"/>
        </Grid.ColumnDefinitions>
        <ToolBarTray Grid.Row="0" Width="Auto">
            <ToolBarTray.Background>
                <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ControlLightLightColorKey}}"/>
            </ToolBarTray.Background>
            <ToolBar Name="tbrMain" ToolBarTray.IsLocked="True" ToolBar.OverflowMode="Never" Margin="0,0,-13,0" Loaded="tbrMain_Loaded" HorizontalAlignment="Left" 
                     Width="{Binding ActualWidth,
                             RelativeSource={RelativeSource FindAncestor,
                                           AncestorType={x:Type ToolBarTray}}}">
                <ToolBar.Background>
                    <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ControlLightLightColorKey}}"/>
                </ToolBar.Background>
                <Button Name="btnNewFile" Click="btnNewFile_Click" ToolTip="New settings file" IsTabStop="False">
                    <Image Source="Resources/NewFile.png" >
                        <Image.Style>
                            <Style TargetType="Image">
                                <Style.Triggers>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter Property="Opacity" Value="0.5" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Image.Style>
                    </Image>
                </Button>
                <Button Name="btnOpenFile" Click="btnOpenFile_Click" ToolTip="Open settings file" IsTabStop="False">
                    <Image Source="Resources/OpenFile.png" >
                        <Image.Style>
                            <Style TargetType="Image">
                                <Style.Triggers>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter Property="Opacity" Value="0.5" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Image.Style>
                    </Image>
                </Button>
                <Button Name="btnSaveFile" Click="btnSaveFile_Click" ToolTip="Save settings file" IsTabStop="False">
                    <Image Source="Resources/SaveFile.png" >
                        <Image.Style>
                            <Style TargetType="Image">
                                <Style.Triggers>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter Property="Opacity" Value="0.5" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Image.Style>
                    </Image>
                </Button>
                <Button Name="btnSaveAsFile" Click="btnSaveAsFile_Click" ToolTip="Save settings to new file" IsTabStop="False">
                    <Image Source="Resources/SaveAsFile.png" >
                        <Image.Style>
                            <Style TargetType="Image">
                                <Style.Triggers>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter Property="Opacity" Value="0.5" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Image.Style>
                    </Image>
                </Button>
                <Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" />
                <Button Name ="btnAddFolder" Click="btnAddFolder_Click" ToolTip="Add folder to process files" IsTabStop="False">
                    <Image Source="Resources/AddFile.png" >
                        <Image.Style>
                            <Style TargetType="Image">
                                <Style.Triggers>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter Property="Opacity" Value="0.5" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Image.Style>
                    </Image>
                </Button>
                <Button Name="btnDeleteFolder" Click="btnDeleteFolder_Click" ToolTip="Remove folder from processing files" IsTabStop="False">
                    <Image Source="Resources/DeleteFile.ico" >
                        <Image.Style>
                            <Style TargetType="Image">
                                <Style.Triggers>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter Property="Opacity" Value="0.5" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Image.Style>
                    </Image>
                </Button>
                <Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" IsTabStop="False" />
                <Button Name="btnRun" Click="btnRun_Click" ToolTip="Start processing files" IsTabStop="False">
                    <Image Source="Resources/Run.png" >
                        <Image.Style>
                            <Style TargetType="Image">
                                <Style.Triggers>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter Property="Opacity" Value="0.5" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Image.Style>
                    </Image>
                </Button>
                <Button Name="btnStop" IsEnabled="False" Click="btnStop_Click" ToolTip="Stop the processing files" IsTabStop="False">
                    <Image Source="Resources/Stop.png" >
                        <Image.Style>
                            <Style TargetType="Image">
                                <Style.Triggers>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter Property="Opacity" Value="0.5" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Image.Style>
                    </Image>
                </Button>
                <Button Name="btnClear" IsEnabled="False" Click="btnClear_Click" ToolTip="Clear the status window" IsTabStop="False">
                    <Image Source="Resources/Erase.png" >
                        <Image.Style>
                            <Style TargetType="Image">
                                <Style.Triggers>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter Property="Opacity" Value="0.5" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Image.Style>
                    </Image>
                </Button>
                <Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" IsTabStop="False" />
                <Button Name ="btnUndo" ToolTip="Undo processed files" Click="btnUndo_Click" IsEnabled="False" IsTabStop="False">
                    <Image Source="Resources/Undo.png" >
                        <Image.Style>
                            <Style TargetType="Image">
                                <Style.Triggers>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter Property="Opacity" Value="0.5" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Image.Style>
                    </Image>
                </Button>
                <Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" IsTabStop="False" />
                <TextBlock Name="tbSpace" xml:space="preserve" FontSize="16" FontWeight="Bold" Foreground="DarkBlue"
                           Width="Auto" TextAlignment="Right">   </TextBlock>
                <TextBlock Name="tbSettingsName" FontSize="16" FontWeight="Bold" Foreground="DarkBlue"
                           Width="Auto" VerticalAlignment="Center" FontFamily="Verdana"></TextBlock>
            </ToolBar>
        </ToolBarTray>
        <DockPanel Grid.Row="1" Grid.Column="0"
        Margin="0,0,0,21"
        HorizontalAlignment="Stretch"
        Name="dockPanel1"
        VerticalAlignment="Stretch"
        LastChildFill="True" Grid.RowSpan="2"
        FocusManager.FocusedElement="{Binding ElementName=txtFolder}">
            <Grid
            Width="Auto"
            DockPanel.Dock="Top">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <GroupBox
                Name="grpFolders"
                Margin="5,5,5,5"
                Height="Auto"
                Grid.Column="0"
                Header="Choose a Folder">
                    <Grid
                    Width="Auto"
                    Height="Auto">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="185*" />
                            <ColumnDefinition Width="378*"/>
                            <ColumnDefinition Width="20" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <TextBox 
                        Name="txtFolder"
                        VerticalAlignment="Stretch"
                        Grid.Row="0"
                        Grid.Column="0"
                        Margin="1"
                        TabIndex="0" Grid.ColumnSpan="2" 
                        Style="{StaticResource WaterMarkTextBoxStyle}" 
                        Tag="Choose input folder..."
                        ToolTip="Choose input folder..." KeyDown="txtFolder_KeyDown"
                        />
                        <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
                        Grid.Row="0"
                        Grid.Column="2"
                        Margin="1"
                        Name="btnBrowse"
                        Click="btnBrowse_Click"
                        TabIndex="1" ToolTip="Choose input folder...">
                            <Image Source="Resources/OpenFolder.png" >
                                <Image.Style>
                                    <Style TargetType="Image">
                                        <Style.Triggers>
                                            <Trigger Property="IsEnabled" Value="False">
                                                <Setter Property="Opacity" Value="0.5" />
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </Image.Style>
                            </Image>
                        </Button>
                        <TextBox
                        Name="txtCopyMoveToFolder" Text="{Binding Path=MoveOrCopyToDirectory, UpdateSourceTrigger=PropertyChanged}"
                        Grid.Row="1" 
                        Grid.Column="0"
                        Margin="1"
                        TabIndex="2" Grid.ColumnSpan="2" 
                        Style="{StaticResource WaterMarkTextBoxStyle}"
                        Tag="Choose optional move/copy to folder..."
                        ToolTip="Choose optional move/copy to folder..."/>
                        <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
                        Grid.Row="1"
                        Grid.Column="2"
                        Margin="1"
                        Name="btnMoveCopyBrowse"
                        TabIndex="3" ToolTip="Choose move/copy to folder..."
                                Click="btnMoveCopyBrowse_Click" >
                            <Image Source="Resources/OpenFolder.png" >
                                <Image.Style>
                                    <Style TargetType="Image">
                                        <Style.Triggers>
                                            <Trigger Property="IsEnabled" Value="False">
                                                <Setter Property="Opacity" Value="0.5" />
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </Image.Style>
                            </Image>
                        </Button>
                        <TextBox
                        Name="txtPlugInsFolder"
                        VerticalAlignment="Stretch"
                        Grid.Row="2"
                        Grid.Column="0"
                        Text="{Binding Path=PlugInsFolders, UpdateSourceTrigger=PropertyChanged}"
                        Margin="1"
                        TabIndex="4" Grid.ColumnSpan="2" 
                        Style="{StaticResource WaterMarkTextBoxStyle}"
                        Tag="Choose optional plug-ins folder..."
                        ToolTip="Choose optional plug-ins folder..." TextChanged="txtPlugInsFolder_TextChanged" LostFocus="txtPlugInsFolder_LostFocus" />
                        <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
                        Grid.Row="2"
                        Grid.Column="2"
                        Margin="1"
                        Name="btnPlugsBrowse"
                        TabIndex="5" ToolTip="Choose plug-ins folder..." Click="btnPlugsBrowse_Click" >
                            <Image Source="Resources/OpenFolder.png" >
                                <Image.Style>
                                    <Style TargetType="Image">
                                        <Style.Triggers>
                                            <Trigger Property="IsEnabled" Value="False">
                                                <Setter Property="Opacity" Value="0.5" />
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </Image.Style>
                            </Image>
                        </Button>
                    </Grid>
                </GroupBox>
            </Grid>
            <Grid
            Width="Auto">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition
                    Height="100"
                    MinHeight="100" />
                    <RowDefinition
                    Height="Auto" />
                    <RowDefinition
                    Height="*"
                    MinHeight="100" />
                </Grid.RowDefinitions>
                <GroupBox
                Margin="5,0,5,0"
                Grid.Row="0"
                Header="Folder(s)"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Stretch">
                    <ListBox
                    Margin="0,3,0,2"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch"
                    Name="lstFolders"
                    TabIndex="24" />
                </GroupBox>
                <GridSplitter
                Margin="5,5,5,0"
                ResizeDirection="Rows"
                Grid.Row="1"
                Height="1"
                HorizontalAlignment="Stretch" IsTabStop="False" />
                <GroupBox
                Margin="5,0,5,5"
                Grid.Row="2"
                Header="Status"
                VerticalAlignment="Stretch">
                    <TextBox
                    Margin="0,3,0,2"
                    VerticalAlignment="Stretch"
                    Name="txtStatus"
                    Focusable="False"
                    TabIndex="25" FontFamily="Courier New" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" />
                </GroupBox>
            </Grid>
        </DockPanel>
        <GridSplitter Width="3" HorizontalAlignment="Right" VerticalAlignment="Stretch" ResizeBehavior="BasedOnAlignment" IsTabStop="False" ResizeDirection="Columns" />
        <DockPanel Grid.Column="1" Grid.RowSpan="2" Margin="1,0,0,0" LastChildFill="True">
            <GroupBox
            Margin="0,0,2,0"
            DockPanel.Dock="Right"
            Width="Auto"
            Height="Auto"
            Header="Settings">
                <Grid
                Width="Auto"
                Height="Auto">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <StackPanel Grid.Row="0"
                        DockPanel.Dock="Bottom">
                        <GroupBox
                            Margin="1"
                            Name="grpMove"
                            DockPanel.Dock="Right"
                            Height="Auto"
                            Header="Copy/Move">
                            <StackPanel>
                                <RadioButton
                                    GroupName="grpCopyMove"
                                    Padding="5,0,1,1"
                                    Margin="1, 5, 1, 1"
                                    Name="rdoMove"
                                    Height="Auto"
                                    TabIndex="6"
                                    Content="Move"
                                    IsChecked="{Binding Path=DoCopy, Converter={StaticResource BoolInverterConverter1}}"
                                    ToolTip="If selected, it will move the files with new names." />
                                <RadioButton
                                    GroupName="grpCopyMove"
                                    Padding="5,0,1,1"
                                    Margin="1"
                                    Name="rdoCopy"
                                    Height="Auto"
                                    TabIndex="7"
                                    Content="Copy"
                                    IsChecked="{Binding Path=DoCopy}"
                                    ToolTip="If selected, it will copy the files with new names." />
                            </StackPanel>
                        </GroupBox>
                        <GroupBox
                            Margin="1"
                            Name="grpOptions"
                            DockPanel.Dock="Right"
                            Height="Auto"
                            Header="Options">
                            <StackPanel>
                                <CheckBox
                                    Padding="5,0,1,1"
                                    Margin="1, 5, 1, 1"
                                    Name="chkPreviewMode"
                                    Height="Auto"
                                    TabIndex="8"
                                    Content="Preview Mode"
                                    IsChecked="{Binding Path=PreviewMode}"
                                    ToolTip="If checked, it will just list all the matching files. Otherwise, it will clean up the files." />
                                <CheckBox
                                    Padding="5,0,1,1"
                                    Margin="1"
                                    Name="chkIncludeSubDir"
                                    Height="Auto"
                                    TabIndex="9"
                                    Content="Recursive"
                                    IsChecked="{Binding Path=IncludeSubDir}"
                                    ToolTip="Include subdirectory for search" />
                                <CheckBox
                                    Padding="5,0,1,1"
                                    Margin="1"
                                    Name="chkOverwrite"
                                    Height="Auto"
                                    TabIndex="10"
                                    Content="Overwrite"
                                    IsChecked="{Binding Path=Overwrite}"
                                    ToolTip="Destination file will be overwritten if exists" />
                                <!--<CheckBox
                                    Padding="5,0,1,1"
                                    Margin="1"
                                    Name="chkCreateEmptyDir"
                                    Height="Auto"
                                    TabIndex="11"
                                    Content="Create Empty Dir"
                                    IsChecked="{Binding Path=CreateEmptyDir}"
                                    ToolTip="Create empty directory, if no matching files found." />-->
                                <CheckBox
                                    Padding="5,0,1,1"
                                    Margin="1"
                                    Name="chkResolveCollision"
                                    Height="Auto"
                                    TabIndex="12"
                                    Content="Resolve Collision"
                                    IsChecked="{Binding Path=ResolveCollision}"
                                    ToolTip="Resolve filename collision automatically" />
                            </StackPanel>
                        </GroupBox>
                        <GroupBox
                            Margin="1"
                            DockPanel.Dock="Right"
                            Height="Auto"
                            Header="Target"
                            Name="grpMatch">
                            <StackPanel>
                                <CheckBox
                                    Padding="5,0,1,1"
                                    Margin="1, 5, 1, 1"
                                    Name="chkMatchFile"
                                    Height="Auto"
                                    TabIndex="13"
                                    Content="Files"
                                    IsChecked="{Binding Path=IsFileProcessEnabled}"
                                    ToolTip="Match file names for clean up" />
                                <CheckBox
                                    Padding="5,0,1,1"
                                    Margin="1"
                                    Name="chkMatchDir"
                                    Height="Auto"
                                    TabIndex="14"
                                    Content="Folders"
                                    IsChecked="{Binding Path=IsFolderProcessEnabled}"
                                    ToolTip="Match folder names for clean up" />
                            </StackPanel>
                        </GroupBox>
                        <GroupBox
                            Margin="1"
                            DockPanel.Dock="Right"
                            Height="Auto"
                            Header="Find/Replace Cmds"
                            Name="grpValidFileExts">
                            <StackPanel>
                                <TextBox
                                    Controls:TextBoxHelper.Watermark="This is a textbox" 
                                    Margin="0,5,0,0"
                                    Name="txtFileFindMatchingExpr"
                                    Text="{Binding Path=FileFindMatchingExpr, UpdateSourceTrigger=PropertyChanged}"
                                    Height="Auto"
                                    TabIndex="15" 
                                    Tag="Find Text" 
                                    ToolTip="Enter file name find expression..." 
                                    Style="{StaticResource WaterMarkTextBoxStyle}" 
                                    />
                                <TextBox
                                    Margin="0,5,0,0"
                                    Name="txtFileReplaceMatchingExpr"
                                    Text="{Binding Path=FileReplaceMatchingExpr, UpdateSourceTrigger=PropertyChanged}"
                                    Height="Auto"
                                    TabIndex="16" 
                                    Tag="Replace Text" 
                                    ToolTip="Enter file name replace expression..." 
                                    Style="{StaticResource WaterMarkTextBoxStyle}" 
                                    />
                                <Grid
                                        Margin="0,5,0,0"
                                    >
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition/>
                                        <RowDefinition/>
                                        <RowDefinition/>
                                    </Grid.RowDefinitions>
                                    <TextBox Grid.Row="0" Grid.Column="0"
                                        Name="txtTransText"
                                        Text="{Binding Path=FileTransText, UpdateSourceTrigger=PropertyChanged}"
                                        Height="Auto"
                                        TabIndex="17" 
                                        Tag="Trans Text" 
                                        ToolTip="Enter file name transformation expr, seperated by ;" 
                                        Style="{StaticResource WaterMarkTextBoxStyle}" 
                                        />
                                    <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
                                        Grid.Row="0"
                                        Grid.Column="1"
                                        Margin="0"
                                        Name="btnOpenExprEditor"
                                        TabIndex="18" ToolTip="Open Expression Editor..." Click="btnOpenExprEditor_Click">
                                        <Image Source="Resources/ExprEditor.png" 
                                               Width="16" 
                                               Height="16" >
                                                            <Image.Style>
                                                                <Style TargetType="Image">
                                                                    <Style.Triggers>
                                                                        <Trigger Property="IsEnabled" Value="False">
                                                                            <Setter Property="Opacity" Value="0.5" />
                                                                        </Trigger>
                                                                    </Style.Triggers>
                                                                </Style>
                                                            </Image.Style>
                                                        </Image>
                                    </Button>
                                    <RadioButton
                                        Grid.Row="1"
                                        Grid.Column="0"
                                        Grid.ColumnSpan="2"
                                        GroupName="grpMatchType"
                                        Padding="5,0,1,1"
                                        Margin="1,5,0,0"
                                        Name="rdoWildcard"
                                        Height="Auto"
                                        TabIndex="21"
                                        Content="Use Wildcard"
                                        IsChecked="{Binding Path=UseWildcard}"
                                        ToolTip="Use Wildcard to match files/folders" />
                                    <RadioButton
                                        Grid.Row="2"
                                        Grid.Column="0"
                                        GroupName="grpMatchType"
                                        Padding="5,0,1,1"
                                        Margin="1,2,0,0"
                                        Name="rdoRegex"
                                        Height="Auto"
                                        TabIndex="22"
                                        Content="Use Regex"
                                        IsChecked="{Binding Path=UseWildcard, Converter={StaticResource BoolInverterConverter2}}"
                                        ToolTip="Use Regex to match files/folders" />
                                    <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
                                        Grid.Row="2"
                                        Grid.Column="1"
                                        Margin="0"
                                        Name="btnRegexHelp"
                                        TabIndex="18" ToolTip="Regular Expression Quick Reference..." Click="btnRegexHelp_Click">
                                        <Image Source="Resources/Help.png" 
                                                 Width="16" 
                                                Height="16" >
                                            <Image.Style>
                                                <Style TargetType="Image">
                                                    <Style.Triggers>
                                                        <Trigger Property="IsEnabled" Value="False">
                                                            <Setter Property="Opacity" Value="0.5" />
                                                        </Trigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </Image.Style>
                                        </Image>
                                    </Button>
                                </Grid>
                                <Button Content="Advanced" 
                                    Margin="0,5,0,5"
                                    Name="btnPlugIns"
                                    TabIndex="23" 
                                        Click="btnPlugIns_Click" HorizontalContentAlignment="Center"
                                        >
                                    <Button.ContextMenu>
                                        <ContextMenu>
                                            <MenuItem Header="Reset" Click="OnPlugInDefFileReset" >
                                                <MenuItem.Icon>
                                                    <Image Source="Resources/ResetPlugInDefFile.png" />
                                                </MenuItem.Icon>
                                            </MenuItem>
                                            <!--<Separator />
                                            <MenuItem Header="Open" Click="OnPlugInDefFileOpen" >
                                                <MenuItem.Icon>
                                                    <Image Source="Resources/OpenPlugInDefFile.png" />
                                                </MenuItem.Icon>
                                            </MenuItem>-->
                                        </ContextMenu>
                                    </Button.ContextMenu>
                                </Button>
                            </StackPanel>
                        </GroupBox>
                    </StackPanel>
                </Grid>
            </GroupBox>
        </DockPanel>
        <StatusBar Grid.Row="2" Grid.ColumnSpan="2"
            Margin="5,0,1,5"
            Width="Auto">
            <StatusBarItem
                VerticalContentAlignment="Top"
                Focusable="False"
                Padding="0">
                <TextBlock
                    Style="{StaticResource StatusBarTextBlock}"
                    Name="sbAppStatus">Ready</TextBlock>
            </StatusBarItem>
        </StatusBar>
    </Grid>
</Controls:MetroWindow>
